﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using QLPhanQuyen.BO;

namespace QLPhanQuyen.GUI
{
    public partial class ThayDoiMatKhauForm : Office2007Form
    {
        NguoiDungBO NDBO = new NguoiDungBO();
        public ThayDoiMatKhauForm()
        {
            InitializeComponent();
        }

        private void btnDongY_Click(object sender, EventArgs e)
        {
            if(NDBO.KiemTraDangNhap(TrangThaiDangNhap.TenDangNhap, txtMatKhauCu.Text)==false)
            {
                lblLoiMatKhauCu.Visible = true;
            }
            else if(txtMatKhauMoi.Text=="")
            {
                lblLoiMatKhauMoi.Visible = true;
            }
            else if(txtXacNhan.Text.Equals(txtMatKhauMoi.Text)==false)
            {
                lblLoiXacNhan.Visible = true;
            }
            else if(NDBO.DoiMatKhau(TrangThaiDangNhap.TenDangNhap, txtMatKhauMoi.Text))
            {
                MessageBox.Show("Đỗi Mật Khẩu Thành Công");
            }    
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
